import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/layout/index.vue";
import LoginView from "@/views/LoginView.vue";
import DashboardView from "@/views/dashboard/index.vue";
import CommodityManagement from "@/views/commodity/commodity-management.vue";
import OrderManagement from "@/views/order/order-management.vue";
import UserManagement from "@/views/user/user-management.vue";

const router = createRouter({
	history: createWebHistory(import.meta.env.BASE_URL),
	routes: [
		{
			path: "/",
			name: "login",
			component: LoginView,
		},
		{
			path: "/layout",
			name: "layout",
			redirect: "/dashboard",
			component: Layout,
			children: [
				{
					path: "/dashboard",
					name: "dashboard",
					component: DashboardView,
				},
				{
					path: "/commodity-management",
					name: "commodity-management",
					component: CommodityManagement,
				},
				{
					path: "/order-management",
					name: "order-management",
					component: OrderManagement,
				},
				{
					path: "/user-management",
					name: "user-management",
					component: UserManagement,
				},
			],
		},
	],
});

export default router;
